package com.tuzhi.config;

import com.tuzhi.base.redis.MyRedisKeyUtil;

/**
 * 功能说明：
 *
 * @author abu
 * @version 1.1.0
 * @date 2023/3/31
 */
public class ConstantConfig {

    //系统日志内容格式
    public static final String LOGIN_LOG_DIC_NAME = "login_log_format";
    public static final String LOGOUT_LOG_DIC_NAME = "logout_log_format";
    public static final String sys_on = "on";     //系统通用变量，打开
    public static final String sys_off = "off";    //系统通用变量，关闭
    public static final String billVersionKey = "config:bill:webVersion";

    /**
     * “精识别版本号”存取key
     */
    public static final String Fine_Recognition_VersionKey = "config:bill:fine:rec";

    public static final String logUserRedisKey = "auth";

    public static final String loginSourceLimitKey = "loginSourceLimit";

    /**
     * 系统用户初始默认密码
     */
    public static final String SYS_USER_DEFAULT_PASSWORD = "123456";

    /**
     * 所有权限标识
     */
    public static final String ALL_PERMISSION = "*:*:*";

    /**
     * 超级管理员角色名
     */
    public static final String SUPER_ROLE_NAME = "admin";
    /**
     * 企业管理角色名
     */
    public static final String ENTERPRISE_MANAGER_ROLE_NAME = "enterprise_admin";

    /**
     * 存放用户所拥有角色的redis key前缀
     */
    public static final String AUTH_USER_ROLE_CACHE_KEY_PREFIX = "tz_sys_auth:user_roles:";

    /**
     * 存放角色所拥有的权限标识的redis key前缀
     */
    public static final String AUTH_ROLE_PERM_CACHE_KEY_PREFIX = "tz_sys_auth:role_perms:";

    /**
     * 存放角色所拥有的url的redis key前缀
     */
    public static final String AUTH_ROLE_URL_CACHE_KEY_PREFIX = "tz_sys_auth:role_urls:";

    /**
     * 存放角色所拥有的菜单Id的redis key前缀
     */
    public static final String AUTH_ROLE_MENU_CACHE_KEY_PREFIX = "tz_sys_auth:role_menus:";

    private static String getRedisKey(String keyTlp, String... keyValue) {
        return String.format(keyTlp, keyValue);
    }

    public static String getLogUserRedisKey(String key) {
        return MyRedisKeyUtil.tempKey(logUserRedisKey, key);
    }

    public static String getNotAuthUrlRedisKey() {
        return MyRedisKeyUtil.configKey("auth", "notAuthUrl");
    }

    /**
     * 获取字典配置的reids key
     *
     * @param dicName
     * @return
     */
    public static String getDicRedisKey(String dicName) {
        return MyRedisKeyUtil.tempKey("auth", "dic", dicName);
    }
}
